<?php

class m131001_081235_add_column_avatar extends CDbMigration {

    public function up() {
        $qr = Yii::app()->db->createCommand("SHOW COLUMNS FROM ham_user_profile LIKE 'avatar'");
        if (!$qr->queryRow()) {
            $this->addColumn('ham_user_profile', 'avatar', 'varchar(255) NULL');
        }
    }

    public function down() {
        return $this->dropColumn('ham_user_profile', 'avatar');
    }

    /*
      // Use safeUp/safeDown to do migration with transaction
      public function safeUp()
      {
      }

      public function safeDown()
      {
      }
     */
}